package org.xin.security.pojo.bo;

import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import lombok.*;
import lombok.experimental.SuperBuilder;
import org.xin.security.constant.SecurityConstant;

import java.io.Serializable;

/**
 * @author ：xin
 * @date ：Created in 2021/10/5
 * @desc <p>  </p>
 * @modified By：$
 * @version: $
 */
@ApiModel(description = "用户信息保存")
@Getter
@Setter
@Builder
@ToString(callSuper = true)
@AllArgsConstructor
@NoArgsConstructor
public class UserInfo implements Serializable {
    private static final long serialVersionUID = 1L;

    private String id;

    private String address;

    private String avatar;

    private String birth;

    private String email;

    private String nickname;

    private String phone;

    private String sex;

    private String source;

    @JsonIgnore
    private String openId;

    private String sysDeptId;

    @JsonIgnore
    private String password;

    @JsonIgnore
    private String salt;

    private String username;

    private String sysRoleId;

    private String userStatus;

    private String loginIp;

    private String lastLoginTime;

    public boolean isAdmin() {
        return isAdmin(this.id);
    }

    public static boolean isAdmin(String id) {
        return SecurityConstant.ADMIN_ID.equals(id);
    }
}
